﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;

namespace AppConsole
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                List<string> excludeTableColumnList = new List<string>()
                {
                    "KeyId",
                    "CreateUserKeyId",
                    "UpdateUserKeyId",
                    "CreateTime",
                    "UpdateTime",
                    "Version",
                    "IsDelete",
                };

                foreach (var item in excludeTableColumnList)
                {

                    
                }

            }

            {
                Guid sdf = Guid.NewGuid();
                SqlConnection conn = new SqlConnection("Data Source=127.0.0.1;Initial Catalog=DDD;User ID=sa;Password=111111;");
                conn.Open();
                DataTable schema = conn.GetSchema("TABLES");
                string strSql = "select top 1 * from @tableName";
                SqlCommand command = new SqlCommand(strSql, conn);
                SqlDataAdapter ad = new SqlDataAdapter(command);
                DataSet ds = new DataSet();

                foreach (DataRow row in schema.Rows)
                {

                    ds.Tables.Clear();
                    command.CommandText = strSql.Replace("@tableName", row["TABLE_NAME"].ToString());
                    ad.FillSchema(ds, SchemaType.Mapped, row["TABLE_NAME"].ToString());
                    foreach (DataColumn dc in ds.Tables[0].Columns)
                    {
                        string nnn = dc.DataType.Name;



                    }
                }
            }




            Console.WriteLine($"{Environment.CurrentDirectory}");
            Console.WriteLine($"{Directory.GetCurrentDirectory()}");
            Console.WriteLine($"{(new object()).GetType().Assembly.Location}");
            Console.WriteLine($"{Process.GetCurrentProcess().MainModule.FileName}");
            Console.WriteLine($"{AppDomain.CurrentDomain.BaseDirectory}");
            Console.WriteLine("Hello World!");
            Console.ReadLine();
        }
    }
}
